using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using RFS.BizLogic.PaiShi.Accounting;
using RFS.Domain.PaiShi.WorkFlow;

namespace RFS.Domain.PaiShi.Accounting
{
    public interface IDayBasedWorkFlowNodeAccountingVoucherSetWrapper
    {

         AccountPeriod AccPeriod { get; set; }

         void AddAv(IOrderItemBasedAccountingVoucher av);
        IEnumerable<IOrderItemBasedAccountingVoucher> Vouchers { get; }
        IWorkFlowNodeWrapper LeftNode { get; set; }
        IWorkFlowNodeWrapper RightNode { get; set; }
        VoucherSetState State { get;   }
        string KeyNote { get; }
        IProblem Problem { get; }
        bool IsBalanced { get; }
        Amount Balance { get ; }
        IEnumerable<IOrderItemBasedAccountingVoucher> ManualVouchers { get; }
        ulong Id { get; set; }
        Amount DebitTotal { get ; }
        Amount CreditTotal { get; }
        event EventHandler SourceDataLoaded; 
        event EventHandler Changed;  

        IOrderItemBasedAccountingVoucher GetMyVoucherByLeftOrderId(string bizid);
        // IEnumerable<IOrderItem> GetHistoryUnRecorderOrder(AccountPeriod period);
        void CheckToCreateAVs(bool silenct=false );
        IOrderItemBasedAccountingVoucher CreateAV(IOrderItem d, IOrderItem c);
        Task LoadLeftNodeDataAsync();
        Task LoadRightNodeDataAsync(bool fromProdLine=true, bool regroup=false);
        IEnumerable<IOrderItem> GetYSCandiatesFor(OrderItemBasedAccountingVoucher orderItemBasedAccountingVoucher,
            bool includeHistory = false, bool compareCashe = true);

        IOrderItemBasedAccountingVoucher CreateAV( IEnumerable<IOrderItem> ghos,  IEnumerable<IOrderItem> ysos);
        void GotoDefferenceProcess();
        // event EventHandler<VoucherSetState> StateChanged;
        event EventHandler<(VoucherSetState oldState, VoucherSetState newStete)> StateChanged;
        void GotoPreparingData();
        bool IsInRecordedAcc(IOrderItem o);
        void ReProcessDefferences (bool overrideData=false);
        void RemoveAV (IOrderItemBasedAccountingVoucher o);
        IOrderItemBasedAccountingVoucher GetMyVoucherByOrder(IOrderItem orderItem);
        void OnChangedNow();
    }
}